import { Injectable } from '@angular/core';
import {ConfigService} from './config.service';
import {HttpClient} from '@angular/common/http';
import {Carousel} from '../model/Carousel';

@Injectable({
  providedIn: 'root'
})
export class CarouselService {

  constructor(private config:ConfigService
  ,private http:HttpClient) { }

  private getCarouselUrl=this.config.HOST+"/manage/getCarousel";
  getCarousel(id:string){
    let parm={
      "carouselid":id
    }
    return this.http.post(this.getCarouselUrl,parm).toPromise();
  }

  private saveCarouselUrl=this.config.HOST+"/manage/saveCarousel";
  saveCarousel(carousel:Carousel){
    return this.http.post(this.saveCarouselUrl,carousel).toPromise();
  }

  private deleteCarouselUrl=this.config.HOST+"/manage/deleteCarousel";
  deleteCarousel(id:string){
    let parm={
      "carouselid":id
    }
    return this.http.post(this.deleteCarouselUrl,parm).toPromise();
  }

  private getCarouselListUrl=this.config.HOST+"/public/getCarouselList";
  getCarouselList(){
    return this.http.get(this.getCarouselListUrl).toPromise();
  }

}
